// 手动连接信号与槽
Rectangle {
    id: relay;
 
    signal messageReceived(string person, string notice);
 
    Component.onCompleted: {
        // 信号与槽的连接
        relay.messageReceived.connect(sendToPost);
        relay.messageReceived.connect(sendToTelegraph);
        relay.messageReceived.connect(sendToEmail);
        // 发射信号
        relay.messageReceived("Tom", "Happy Birthday");
    }
 
    function sendToPost(person, notice) {
        console.log("Sending to post: " + person + ", " + notice);
    }
    function sendToTelegraph(person, notice) {
        console.log("Sending to telegraph: " + person + ", " + notice);
    }
    function sendToEmail(person, notice) {
        console.log("Sending to email: " + person + ", " + notice);
    }
}
